from sqlalchemy import func

from airflow.models import DagModel
# from airflow.models.dagrun import DagRun
from airflow.utils.session import create_session
# import time


# def update_state(dr_id):
#     with create_session() as session:
#         dr = session.query(DagRun).filter(DagRun.id == dr_id).first()
#         dr.update_state(session=session)
#         time.sleep(1800)


if __name__ == '__main__':
    with create_session() as session:
        query = DagModel.dags_needing_dagruns(session)
        print(query)
        print(func.now())

